home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SATAN11.ZIP / SRC / PORT_SCA / OPEN_LIM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-04  |  512 b   |  30 lines

  1.  /*
  2.   * open_limit - determine the current open file limit
  3.   * 
  4.   * Environment: POSIX, 44BSD, 43BSD
  5.   * 
  6.   * Author: Wietse Venema.
  7.   */
  8.  
  9. #include <sys/types.h>
  10. #include <sys/time.h>
  11. #include <sys/resource.h>
  12.  
  13. /* 44BSD compatibility. */
  14. #ifdef RLIMIT_OFILE
  15. #define RLIMIT_NOFILE RLIMIT_OFILE
  16. #endif
  17.  
  18. int     open_limit()
  19. {
  20. #ifdef RLIMIT_NOFILE
  21.     struct rlimit rl;
  22.  
  23.     getrlimit(RLIMIT_NOFILE, &rl);
  24.     return (rl.rlim_cur);
  25. #else
  26.             return (getdtablesize());
  27. #endif
  28. }
  29.  
  30.